package io;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 缓冲字节输出流写数据的缓冲区问题
 * @author Xiloer
 *
 */
public class BOS_flushDemo {
	public static void main(String[] args) throws IOException {
		FileOutputStream fos = new FileOutputStream("bos.txt");
		BufferedOutputStream bos = new BufferedOutputStream(fos);
		
		String str = "你在南方的艳阳里，大雪纷飞。";
		byte[] data = str.getBytes("UTF-8");
		bos.write(data);
		/*
		 * void flush()
		 * 强制将缓冲流的缓冲区中已经缓存的数据写出
		 */
//		bos.flush();
		System.out.println("写出完毕!");
		
		bos.close();
	}
}







